function s = set(s,varargin)
% SET Set lpcvd_2DSurface properties to the specified values
% and return the updated object

propertyArgIn = varargin;
while length(propertyArgIn) >= 2
    prop = propertyArgIn{1};
    val = propertyArgIn{2};
    propertyArgIn = propertyArgIn(3:end);
    switch prop
		case 'h'
			s.h = val;
		case 'x'
			s.x = val;
		case 'y'
			s.y  = val;
		case 'site_width'
			s.site_width = val;
		case 'site_width_unit'
			s.site_width_unit = val;
		case 'layer_thickness'
			s.layer_thickness = val;
		case 'layer_thickness_unit'
			s.layer_thickness_unit = val;
		otherwise
			error('Undefined field');
    end
end